---
layout: default
---
<main>
	<div class="container">
		<h2>{{ page.board_name }}</h2>
		<p>Minimal, pure and up-to-date vanilla Debian/Ubuntu Linux SD card image for <i>{{ page.board_name }}</i>.</p>
		<hr>
	</div>
	<div class="container">
		<dl class="row">
			<dt class="col-6 text-end"><strong>Board name</strong></dt>
			<dd class="col-6">{{ page.board_name }}</dd>
			<dt class="col-6 text-end"><strong>Board maker</strong></dt>
			<dd class="col-6">{{ page.board_maker_name }}</dd>
			<dt class="col-6 text-end"><strong>SoC</strong></dt>
			<dd class="col-6">{{ page.board_soc_name }}</dd>
			<dt class="col-6 text-end"><strong>CPU</strong></dt>
			<dd class="col-6">{{ page.board_cpu_name }}</dd>
		</dl>
		<hr>
	</div>
	<div class="container">
		<h3>Install instructions</h3>
		<div class="alert alert-warning d-none" id="unsupported-warning" role="alert">This board is not supported by any boot image and/or Debian/Ubuntu image</div>
		<div class="d-flex align-items-start" id="install-instructions">
			<div class="col-3 nav flex-column nav-pills pe-3" id="v-pills-tab" role="tablist" aria-orientation="vertical">
{% assign x = site.debians | where: "arch", page.board_cpu_arch_debian | sort %}
{% for debian in x %}
{% capture i %}{{ debian.os }}{{ debian.dist }}{{ debian.arch }}{% endcapture %}
				<button class="nav-link text-start d-none" id="v-pills-install-{{ i }}-tab" data-bs-toggle="pill" data-bs-target="#v-pills-install-{{ i }}" type="button" role="tab" aria-controls="v-pills-install-{{ i }}" aria-selected="true">{{ debian.name }}</button>
{% endfor %}
			</div>
			<div class="col-9 tab-content" id="v-pills-tab-content">
{% assign x = site.debians | where: "arch", page.board_cpu_arch_debian | sort %}
{% for debian in x %}
{% capture i %}{{ debian.os }}{{ debian.dist }}{{ debian.arch }}{% endcapture %}
				<div class="tab-pane fade d-none" id="v-pills-install-{{ i }}" role="tabpanel" aria-labelledby="v-pills-install-{{ i }}-tab" tabindex="0">
					<p class="bg-dark-subtle border border-dark-subtle rounded py-2 px-3">
						<code class="shell-normal text-body-emphasis">wget https://dl.sd-card-images.johang.se<span id="install-{{ i }}-boot_path">/PLACEHOLDER1.bin.gz</span></code><br>
						<code class="shell-normal text-body-emphasis">wget https://dl.sd-card-images.johang.se<span id="install-{{ i }}-debian_path">/PLACEHOLDER2.bin.gz</span></code><br>
						<code class="shell-normal text-body-emphasis">zcat <span id="install-{{ i }}-boot_file">boot.bin.gz</span> <span id="install-{{ i }}-debian_file">debian.bin.gz</span> &gt; sd-card.img</code><br>
						<code class="shell-root text-body-emphasis">dd if=sd-card.img of=/dev/sdXXX <span class="text-info-emphasis"># ...where /dev/sdXXX is your SD card</span></code><br>
					</p>
{% if debian.exp == true %}
					<div class="alert alert-danger" role="alert">This image is experimental</div>
{% endif %}
					<p>When the <code>dd</code> command is done, put the SD card in your board and power it on. The board will boot up and assign itself an IP address using DHCP. The last part of the Debian/Ubuntu image filename is the default root password ("<span id="install-{{ i }}-password">PLACEHOLDER</span>" for this image).</p>
				</div>
{% endfor %}
			</div>
		</div>
		<hr>
	</div>
	<div class="container" id="downloads">
		<h3>Downloads for {{ page.board_name }}</h3>
		<table class="table table-sm table-hover">
			<caption>Downloads relevant to {{ page.board_name }}.</caption>
			<thead>
				<tr>
					<th scope="col">File</th>
					<th scope="col">Description</th>
					<th scope="col">Build date</th>
					<th scope="col">Size</th>
				</tr>
			</thead>
			<tbody>
				<tr id="downloads-boot" class="d-none">
					<td><i class="bi-download"></i> <a href="" id="downloads-boot-link">PLACEHOLDER</a></td>
					<td>Boot image <a class="badge text-bg-primary text-decoration-none d-none" id="downloads-boot-u-boot" href="https://source.denx.de/u-boot/u-boot">U-Boot PLACEHOLDER</a> <a class="badge text-bg-secondary text-decoration-none d-none" id="downloads-boot-atf" href="https://github.com/ARM-software/arm-trusted-firmware">TF-A PLACEHOLDER</a> <a class="badge text-bg-secondary text-decoration-none d-none" id="downloads-boot-rpi-firmware" href="https://github.com/raspberrypi/firmware">RPi boot FW PLACEHOLDER</a> <a class="badge text-bg-secondary text-decoration-none d-none" id="downloads-boot-amlogic-boot-fip" href="https://github.com/LibreELEC/amlogic-boot-fip">AML boot FW PLACEHOLDER</a></td>
					<td id="downloads-boot-build">PLACEHOLDER</td>
					<td id="downloads-boot-size">PLACEHOLDER</td>
				</tr>
{% assign x = site.debians | where: "arch", page.board_cpu_arch_debian | sort %}
{% for debian in x %}
{% capture i %}{{ debian.os }}{{ debian.dist }}{{ debian.arch }}{% endcapture %}
				<tr id="downloads-{{ i }}" class="d-none">
					<td><i class="bi-download"></i> <a href="" id="downloads-{{ i }}-link">PLACEHOLDER</a></td>
					<td>{{ debian.name }} image {% if debian.exp == true %}<span class="badge text-bg-danger">Experimental</span>{% endif %} <span class="badge text-bg-primary d-none" id="downloads-{{ i }}-kernel">Kernel PLACEHOLDER</span></td>
					<td id="downloads-{{ i }}-build">PLACEHOLDER</td>
					<td id="downloads-{{ i }}-size">PLACEHOLDER</td>
				</tr>
{% endfor %}
			</tbody>
		</table>
		<hr>
	</div>
	<div class="container">
		<h3>Boards by {{ page.board_maker_name }}</h3>
		<table class="table table-sm table-hover">
			<caption>Boards made by {{ page.board_maker_name }}.</caption>
			<thead>
				<tr>
					<th scope="col">Board</th>
					<th scope="col">Board maker</th>
					<th scope="col">SoC</th>
					<th scope="col">CPU</th>
				</tr>
			</thead>
			<tbody>
				<tr data-href="/boards/{{ page.board_id }}.html">
					<td><i>{{ page.board_name }}</i></td>
					<td><i>{{ page.board_maker_name }}</i></td>
					<td><i>{{ page.board_soc_name }}</i></td>
					<td><i>{{ page.board_cpu_name }}</i></td>
				</tr>
{% assign x = site.boards | where_exp: "item", "item.board_maker_name == page.board_maker_name" | where_exp: "item", "item.board_id != page.board_id" | sort_natural: "board_name" %}
{% for board in x %}
{% capture i %}{{ debian.os }}{{ debian.dist }}{% endcapture %}
				<tr data-href="/boards/{{ board.board_id }}.html">
					<td><a href="/boards/{{ board.board_id }}.html">{{ board.board_name }}</a></td>
					<td>{{ board.board_maker_name }}</td>
					<td>{{ board.board_soc_name }}</td>
					<td>{{ board.board_cpu_name }}</td>
				</tr>
{% endfor %}
			</tbody>
		</table>
		<hr>
	</div>
	<div class="container">
		<h3>Boards with {{ page.board_soc_name }}</h3>
		<table class="table table-sm table-hover">
			<caption>Boards with {{ page.board_soc_name }} SoC.</caption>
			<thead>
				<tr>
					<th scope="col">Board</th>
					<th scope="col">Board maker</th>
					<th scope="col">SoC</th>
					<th scope="col">CPU</th>
				</tr>
			</thead>
			<tbody>
				<tr data-href="/boards/{{ page.board_id }}.html">
					<td><i>{{ page.board_name }}</i></td>
					<td><i>{{ page.board_maker_name }}</i></td>
					<td><i>{{ page.board_soc_name }}</i></td>
					<td><i>{{ page.board_cpu_name }}</i></td>
				</tr>
{% assign x = site.boards | where_exp: "item", "item.board_soc_name == page.board_soc_name" | where_exp: "item", "item.board_id != page.board_id" | sort_natural: "board_name" %}
{% for board in x %}
{% capture i %}{{ debian.os }}{{ debian.dist }}{% endcapture %}
				<tr data-href="/boards/{{ board.board_id }}.html">
					<td><a href="/boards/{{ board.board_id }}.html">{{ board.board_name }}</a></td>
					<td>{{ board.board_maker_name }}</td>
					<td>{{ board.board_soc_name }}</td>
					<td>{{ board.board_cpu_name }}</td>
				</tr>
{% endfor %}
			</tbody>
		</table>
		<hr>
	</div>
</main>
<script type="text/javascript">
	var base_url = "https://dl.sd-card-images.johang.se";
	var board = "{{ page.board_id }}";
	var arch = "{{ page.board_cpu_arch_debian }}";
	var dtb = "{{ page.board_dtb_name }}";

	var all_boots = [];
	function handle_boots(boots) {
		all_boots = boots;
	}

	var all_debians = [];
	function handle_debians(debians) {
		all_debians = debians;
	}
</script>
<script src="https://cdn.sd-card-images.johang.se/index-boots.js"></script>
<script src="https://cdn.sd-card-images.johang.se/index-debians-{{ page.board_cpu_arch_debian }}.js"></script>
<script type="text/javascript">
	function basename(path) {
		return path.substring(Math.max(0, path.lastIndexOf("/") + 1));
	}

	// Find supported boots
	supported_boots = [];
	all_boots.forEach(function(boot) {
		if (boot["board"] != board)
			return;

		supported_boots.push(boot);
	});
	console.log("Found " + supported_boots.length + " supported boot images");

	// Find supported debians
	supported_debians = [];
	all_debians.forEach(function(debian) {
		if (debian["arch"] != arch)
			return;

		if (dtb == "N/A") {
			supported_debians.push(debian);
		} else {
			debian["dtbs"].forEach(function(_dtb) {
				if (_dtb == dtb)
					supported_debians.push(debian);
			});
		}
	});
	console.log("Found " + supported_debians.length + " supported Debian/Ubuntu images");

	if (supported_boots.length > 0) {
		boot = supported_boots[0];

		// Update download list
		$("#downloads-boot-link").text(basename(boot["path"])).attr("href", base_url + boot["path"]);
		$("#downloads-boot-build").text(boot["build"] + " (" + moment(boot["builddate"]).fromNow() + ")");
		$("#downloads-boot-size").text(Math.round(boot["size"] / 1024) + " kB");
		if ("u-boot" in boot["versions"])
			$("#downloads-boot-u-boot").text("U-Boot " + boot["versions"]["u-boot"]).removeClass("d-none");
		if ("atf" in boot["versions"])
			$("#downloads-boot-atf").text("TF-A " + boot["versions"]["atf"]).removeClass("d-none");
		if ("rpi-firmware" in boot["versions"])
			$("#downloads-boot-rpi-firmware").text("RPi boot FW " + boot["versions"]["rpi-firmware"]).removeClass("d-none");
		if ("amlogic-boot-fip" in boot["versions"])
			$("#downloads-boot-amlogic-boot-fip").text("AML boot FIP " + boot["versions"]["amlogic-boot-fip"]).removeClass("d-none");
		$("#downloads-boot").removeClass("d-none").addClass("show");
	}

	supported_debians.forEach(function(debian) {
		i = debian["os"] + debian["dist"] + debian["arch"];

		// Update download list
		$("#downloads-" + i + "-link").text(basename(debian["path"])).attr("href", base_url + debian["path"]);
		$("#downloads-" + i + "-build").text(debian["build"] + " (" + moment(debian["builddate"]).fromNow() + ")");
		$("#downloads-" + i + "-size").text(Math.round(debian["size"] / (1024 * 1024)) + " MB");
		if ("kernel" in debian["versions"])
			$("#downloads-" + i + "-kernel").text("Kernel " + debian["versions"]["kernel"]).removeClass("d-none");
		$("#downloads-" + i).removeClass("d-none").addClass("show");
	});

	if (supported_boots.length > 0 && supported_debians.length > 0) {
		boot = supported_boots[0];

		supported_debians.forEach(function(debian) {
			i = debian["os"] + debian["dist"] + debian["arch"];

			// Update install instructions
			$("#install-" + i + "-boot_file").text(basename(boot["path"]));
			$("#install-" + i + "-boot_path").text(boot["path"]);
			$("#install-" + i + "-debian_file").text(basename(debian["path"]));
			$("#install-" + i + "-debian_path").text(debian["path"]);
			$("#install-" + i + "-password").text(debian["password"]);
			$("#v-pills-install-" + i + "-tab").removeClass("d-none").addClass("show");
			$("#v-pills-install-" + i).removeClass("d-none");
		});

		// Set first visible tab to active
		$("#install-instructions button:not(.d-none):first").addClass("active");
		$("#install-instructions #v-pills-tab-content div:not(.d-none):first").addClass(["active", "show"]);
	} else {
		$("#unsupported-warning").removeClass("d-none");
		$("#install-instructions").addClass("d-none");
	}
</script>
